﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MediaPortal.Configuration;


namespace BierdopjeTV.Helpers
{
    
    class Logger
    {
        static String m_filename = Config.GetFolder(Config.Dir.Log) + @"\BierdopjeTV.log";
        static StreamWriter m_LogStream;

        public static void Write(string tekst, string source)
        {
            if (File.Exists(m_filename))
                m_LogStream = File.AppendText(m_filename);
            else
                m_LogStream = File.CreateText(m_filename);


            
            string sPrefix = DateTime.Now.ToString() +  " - " + source + " - ";

            m_LogStream.WriteLine(sPrefix + tekst);
    

            m_LogStream.Flush();
            m_LogStream.Close();
            m_LogStream.Dispose();
        }
    }
}
